package com.kaifamiao.inner;

public class Phone {

    String brand = "Huawei Mate 80 Pro";

    class MainBoard {

        String brand = "华为";

        public void charge( String brand ){
            System.out.println( "由参数传入的: " + brand );
            System.out.println( "内部类中的成员变量：" + this.brand );
            System.out.println( "宿主类的成员变量: " + Phone.this.brand );
        }

    }

    public static void main(String[] args) {
        Phone phone = new Phone();
        Phone.MainBoard board = phone.new MainBoard();
        board.charge( "UGreen" );

        phone.brand = "荣耀";
        board.charge( "绿联" );
    }
}
